POV-Ray : Newsgroups : povray.beta-test : Small bug, asking for someone to check on latest RC : Re: Small bug, asking for someone to check on latest RC Server Time
29 Jul 2024 10:24:57 EDT (-0400)
  Re: Small bug, asking for someone to check on latest RC  
From: Wolfgang Thaller
Date: 28 May 2002 18:09:56
Message: <3cf40034@news.povray.org>
"Thorsten Froehlich" <tho### [at] trfde> wrote:
> It works as it should and exactly like in all other programming languages
> where the unary operators also have higher precedence than all other
> operators.

Let me give a few counter examples:

Mathematica, Matlab, Haskell, my TI-92+ calculator. I don't currently have
access to any other programming languages that support a power operator.

> [..] Imagine an
> expression like (x+++---y) or (x*-y).  If the unary operator had lower
> precedence they would be illegal, or at least it would make reading the
> expressions much more difficult for a human *and* a computer...

If the first expression was actually legal, then both expressions would
still be legal and have the same meaning, as there is no ambiguity involved.
Those beautiful C expressions are not the point however - we're only talking
about ^ and unary -, all other precedences should stay the same.

> As for the "mathematical notation" argument, [...] common agreements
> in certain groups rather than any standard.

At least where superscript notation for power can be used, no parantheses
are needed, and power has higher precedence than negation. That's
international standard. I'm absolutely sure. I swear. As for notation using
^, I think that should be the same by analogy.

One additional argument: I really think that
5 - x^2
should be the same as
- x^2 + 5

That's what we learned at school, that's what those studied mathematicians
that teach at my university are telling me, and that's what I would be
expecting when I'm writing a POV scene.

Unary minus should have the about same precedence as binary minus, IMHO.
Any deviation from this "mathematical standard" (IMHO) without producing at
least a warning message of some kind *could* be considered a "small bug" in
pov-ray.

Cheers,

Wolfgang Thaller


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.